import type { PageResult } from '@/types/global'
import type { BannerItem, CategoryItem, GuessItem, HotItem } from '@/types/home'
import { http } from '@/utils/http'
import type { PageParams } from '@/types/global'

//首页-广告区域-小程序广告
// 区域展示位置 : 1 为首页（默认值） 2 为商品分类页
export const getHomBannerApi = (distributionSite = 1) => {
  //BannerItem是用来指定result的类型
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    data: {
      // 请求参数
      distributionSite,
    },
  })
}

// 首页 - 前台分类 - 小程序
export const getHomeCategoryApi = () => {
  return http<CategoryItem[]>({
    method: 'GET',
    url: '/home/category/mutli',
  })
}

//首页-热门推荐-小程序
export const getHomeHotApi = () => {
  return http<HotItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}

// 猜你喜欢-小程序
export const getHomeGuesssApi = (data?: PageParams) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data,
  })
}
